package net.inxweb.bluemeerkat.web.rest.exception.mapper;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import org.springframework.stereotype.Component;

@Component
@Provider
public class RestExceptionMapper implements ExceptionMapper<Exception> {
	public Response toResponse(Exception exception) {  
	      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
          .entity(exception.getMessage())
          .type(MediaType.APPLICATION_JSON).build();
	}
}
